import { ApiProperty } from '@nestjs/swagger';
import { Role } from 'src/global-type';

export class CreateSystemUserDto {
  @ApiProperty({ description: '账号', example: 'xxx' })
  account: string;
  @ApiProperty({ description: '用户名', example: '某人' })
  userName: string;
  @ApiProperty({ description: '密码', example: 'xxxxx' })
  password: string;
  @ApiProperty({ description: '角色', example: Role.STAFF })
  role: Role;
  @ApiProperty({ description: '电话', example: '' })
  phoneNumber?: string;
  @ApiProperty({ description: '邮箱', example: '' })
  email?: string;
}

export class UpdateSystemUserDto {
  @ApiProperty({ description: '账号', example: 'xxx' })
  account?: string;
  @ApiProperty({ description: '用户名', example: '某人' })
  userName?: string;
  @ApiProperty({ description: '密码', example: 'xxxxxx' })
  password?: string;
  @ApiProperty({ description: '角色', example: Role.STAFF })
  role?: Role;
  @ApiProperty({ description: '电话', example: '' })
  phoneNumber?: string;
  @ApiProperty({ description: '邮箱', example: '' })
  email?: string;
}

// TODO: 扩展权限
export class UpdateAuthDto {
  @ApiProperty({ description: '目标id' })
  userId?: string; // 用户的 ObjectId
  @ApiProperty({ description: '用户权限', example: [] })
  systemUser?: string[];
  @ApiProperty({ description: '系统日志权限', example: [] })
  systemLog?: string[];
  @ApiProperty({ description: '流量卡权限', example: [] })
  iotSim?: string[];
  @ApiProperty({ description: '网址导航权限', example: [] })
  webNav?: string[];
  @ApiProperty({ description: '系统告警', example: [] })
  systemWarning?: string[];
  @ApiProperty({ description: '物流权限', example: [] })
  logistics?: string[];
}

export class ModifySelfDto {
  @ApiProperty({ description: '用户名', example: '某人' })
  userName?: string;
  @ApiProperty({ description: '电话', example: '' })
  phoneNumber?: string;
  @ApiProperty({ description: '邮箱', example: '' })
  email?: string;
}

export class ModifyPasswordDto {
  @ApiProperty({ description: '密码', example: 'xxxxxx' })
  password: string;
  @ApiProperty({ description: '密码', example: 'xxxxxx' })
  oldPass: string;
}
